{% extends "admin/base_site.html" %}

{% load i18n %}
{% load admin_static %}
{% load admin_urls %}
{% load breadcrumbs %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endblock %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% endblock %}

{% block bodyclass %}{{ block.super }} {{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}

{% if not is_popup %}
{% block breadcrumb-list %}
{% add_crumb 'Home' '/' %}
{% url 'admin:index' as admin_index %}
{% add_crumb 'Administration' admin_index %}
{% url 'admin:app_list' app_label=opts.app_label as app_url %}
{% add_crumb opts.app_label|capfirst app_url %}
{% url opts|admin_urlname:'changelist' as changelist_url %}
{% add_crumb opts.verbose_name_plural|capfirst changelist_url %}
{% url opts|admin_urlname:'change' original.pk|admin_urlquote as object_url %}
{% add_crumb original|truncatewords:"18" object_url %}
{% add_crumb 'Change password' %}
{% endblock %}
{% endif %}

{% block content %}
<form action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">
    {% csrf_token %}
    {% block form_top %}{% endblock %}
    
    {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
    {% if form.errors %}
        <p class="errornote">
        {% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
        </p>
    {% endif %}

    <p>{% blocktrans with username=original %}Enter a new password for the user <strong>{{ username }}</strong>.{% endblocktrans %}</p>

    <fieldset class="aligned">

    <div class="form-row">
      {{ form.password1.errors }}
      {# TODO: get required class on label_tag #}
      <label for="id_password1" class="required">{% trans 'Password' %}:</label> {{ form.password1 }}
    </div>

    <div class="form-row">
      {{ form.password2.errors }}
      {# TODO: get required class on label_tag #}
      <label for="id_password2" class="required">{% trans 'Password (again)' %}:</label> {{ form.password2 }}
      <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p>
    </div>

    </fieldset>

    <div class="submit-row">
        {% if not is_popup %}
        {% include "elements/cancel_button.html" %}
        {% endif %}
        <input type="submit" value="{% trans 'Change password' %}" class="default" />
    </div>

    <script type="text/javascript">document.getElementById("id_password1").focus();</script>
</form>
{% endblock %}
